cmake_minimum_required(VERSION 3.10.2)
set(LIB_DIR ${CMAKE_SOURCE_DIR}/src/main/native/${ANDROID_ABI})
project("testffmpeg")
include_directories(
        ${CMAKE_SOURCE_DIR}/src/main/cpp/include
)

add_library(avcodec SHARED IMPORTED)
set_target_properties(avcodec PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libavcodec.so)

add_library(avdevice SHARED IMPORTED)
set_target_properties(avdevice PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libavdevice.so)

add_library(avfilter SHARED IMPORTED)
set_target_properties(avfilter PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libavfilter.so)

add_library(avformat SHARED IMPORTED)
set_target_properties(avformat PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libavformat.so)

add_library(avutil SHARED IMPORTED)
set_target_properties(avutil PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libavutil.so)

add_library(postproc SHARED IMPORTED)
set_target_properties(postproc PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libpostproc.so)

add_library(swresample SHARED IMPORTED)
set_target_properties(swresample PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libswresample.so)

add_library(swscale SHARED IMPORTED)
set_target_properties(swscale PROPERTIES IMPORTED_LOCATION
        ${LIB_DIR}/libswscale.so)

add_library( audio-decoder
             SHARED
             src/main/cpp/native-lib.cpp
             src/main/cpp/AudioDecoder.cpp
             src/main/cpp/g711.c
            )

find_library( log-lib
              log )

find_library(android-lib
            android)

target_link_libraries(  audio-decoder
                        ${log-lib}
                        ${android-lib}
                        avcodec
                        avformat
                        avutil
                        swresample
                        swscale
                        postproc
                        avfilter
                        avdevice)